package cn.accp.fruitWar;

import java.util.Random;

import cn.accp.fruitWar.baseEntity.Fruit;
import cn.accp.fruitWar.baseEntity.impl.Apple;
import cn.accp.fruitWar.baseEntity.impl.Banana;
import cn.accp.fruitWar.baseEntity.impl.Pear;
import cn.accp.fruitWar.baseEntity.impl.Watermelon;

public class Game {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Random random = new Random();
		Game game = new Game();
		Fruit fruit = game.creatFruit(random.nextInt(4) + 1);
		game.play(fruit);
	}

	public void play(Fruit fruit) {
		fruit.fly();
		fruit.cut();
	}

	public Fruit creatFruit(int choice) {
		Fruit fruit = null;
		switch (choice) {
		case 1:
			fruit = new Apple();
			break;
		case 2:
			fruit = new Banana();
			break;
		case 3:
			fruit = new Pear();
			break;
		case 4:
			fruit = new Watermelon();
			break;
		default:
			break;
		}
		return fruit;
	}
}
